<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html>
<html lang="en">
<head>
	
	<!-- start: Meta -->
	<meta charset="utf-8">
	<title>用户权限管理系统</title>
	<meta name="description" content="Bootstrap Metro Dashboard">
	<meta name="author" content="Dennis Ji">
	<meta name="keyword" content="Metro, Metro UI, Dashboard, Bootstrap, Admin, Template, Theme, Responsive, Fluid, Retina">
	<!-- end: Meta -->
	
	<!-- start: Mobile Specific -->
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<!-- end: Mobile Specific -->
	
	<!-- start: CSS -->
	<link id="bootstrap-style" href="css/bootstrap.min.css" rel="stylesheet">
	<link href="css/bootstrap-responsive.min.css" rel="stylesheet">
	<link id="base-style" href="css/style.css" rel="stylesheet">
	<link id="base-style-responsive" href="css/style-responsive.css" rel="stylesheet">
	<link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800&subset=latin,cyrillic-ext,latin-ext' rel='stylesheet' type='text/css'>
	<!-- end: CSS -->
	

	<!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
	<!--[if lt IE 9]>
	  	<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
		<link id="ie-style" href="css/ie.css" rel="stylesheet">
	<![endif]-->
	
	<!--[if IE 9]>
		<link id="ie9style" href="css/ie9.css" rel="stylesheet">
	<![endif]-->
		
	<!-- start: Favicon -->
	<link rel="shortcut icon" href="img/favicon.ico">
	<!-- end: Favicon -->
	
	<style>
		.horizontal-form{
			display:-moz-box;
			-moz-box-orient:horizontal;

			/* Safari, Opera, and Chrome */
			display:-webkit-box;
			-webkit-box-orient:horizontal;

			/* W3C */
			display:box;
			box-orient:horizontal;
		}
	</style>

	<script>
        function delete_confirm() {
            event.returnValue = confirm("删除操作将无法恢复，确认吗？");
        }
	</script>
		
</head>

<body>
		<div class="container-fluid-full">
		<div class="row-fluid">
			<!-- start: Content -->
			<div id="content" class="span10">

				<ul class="breadcrumb">
					<li>
						<i class="icon-home"></i>
						<a href="/firstPage.do">首页</a>
						<i class="icon-angle-right"></i>
					</li>
					<li><a href="#">用户管理</a></li>
					<li>
						<div class="horizontal-form">
							<a class="btn btn-success" role="button" href="addUser.do">
								<i class="halflings-icon plus"></i>增加用户
							</a>
						</div>

					</li>
				</ul>

				<div class="row-fluid sortable">
					<div class="box span12">
						<div class="box-header" data-original-title>
							<h2><i class="halflings-icon white user"></i><span class="break"></span>用户管理</h2>
							<div class="box-icon">
								<a href="#" class="btn-setting"><i class="halflings-icon white wrench"></i></a>
								<a href="#" class="btn-minimize"><i class="halflings-icon white chevron-up"></i></a>
								<a href="#" class="btn-close"><i class="halflings-icon white remove"></i></a>
							</div>
						</div>

						<form action="manageUser.do" method="get">
                        <span>
                            <select name="field">
                            <option value="account">账户</option>
                            <option value="name">名字</option>
                            <option value="roleLevel">角色等级</option>
                            <option value="sex">性别</option>
                            <option value="telephone">电话</option>
                            <option value="email">邮箱</option>
                            <option value="address">地址</option>
                            </select>

                            <input type="text" name="code"  autofocus>
                            <button type="submit" class="btn btn-primary">
                                查询
                            </button>
                        </span>
						</form>

						<strong>${message}</strong>
						<div class="box-content">
							<table class="table table-hover table-striped table-bordered bootstrap-datatable datatable">
								<thead>
								<tr>
									<th>ID</th>
									<th>帐户</th>
									<th>姓名</th>
									<th>角色等级</th>
									<th>性别</th>
									<th>电话</th>
									<th>邮箱</th>
									<th>地址</th>
									<th>操作</th>
								</tr>
								</thead>
								<tbody>
								<c:if test="${!empty sessionScope.userList}">
									<c:forEach var="user" items="${sessionScope.userList}">
										<tr>
											<td >${user.id}</td>
											<td >${user.account} </td>
											<td >${user.name} </td>
											<td >
												<span class="label label-success">${user.roleLevel}</span>
											</td>
											<td >${user.sex} </td>
											<td >${user.telephone} </td>
											<td >${user.email} </td>
											<td >${user.address} </td>
											<td >
												<c:choose>
													<c:when test="${user.roleLevel >= '3'}">
														<shiro:hasPermission name="5">
															<div class="horizontal-form">
																<a class="btn btn-success" onclick=confirm("确定授予该用户这个角色吗？")
																   href="giveUserRoleView.do?id=${user.id}">
																	<i class="halflings-icon white zoom-in"></i>授予角色
																</a>
																<a class="btn btn-info" href="editUserView.do?id=${user.id}">
																	<i class="halflings-icon white edit"></i>修改用户
																</a>
																<a class="btn btn-danger" onclick="delete_confirm()" href="deleteUser.do?id=${user.id}">
																	<i class="halflings-icon white trash"></i>删除用户
																</a>
															</div>
														</shiro:hasPermission>
													</c:when>
													<c:otherwise>
														<div class="horizontal-form">
															<a class="btn btn-success" href="giveUserRoleView.do?id=${user.id}">
																<i class="halflings-icon white zoom-in"></i>授予角色
															</a>
															<a class="btn btn-info" href="editUserView.do?id=${user.id}">
																<i class="halflings-icon white edit"></i>修改用户
															</a>
															<a class="btn btn-danger" onclick="delete_confirm()" href="deleteUser.do?id=${user.id}">
																<i class="halflings-icon white trash"></i>删除用户
															</a>
														</div>
													</c:otherwise>
												</c:choose>
											</td>
										</tr>
									</c:forEach>
								</c:if>
								</tbody>
							</table>
						</div>
					</div><!--/span-->
				</div><!--/row-->
			</div><!--/.fluid-container-->
			<!-- end: Content -->
		</div><!--/#content.span10-->
		</div><!--/fluid-row-->

	<!-- start: JavaScript-->

		<script src="js/jquery-1.9.1.min.js"></script>
	<script src="js/jquery-migrate-1.0.0.min.js"></script>

		<script src="js/jquery-ui-1.10.0.custom.min.js"></script>

		<script src="js/jquery.ui.touch-punch.js"></script>

		<script src="js/modernizr.js"></script>

		<script src="js/bootstrap.min.js"></script>

		<script src="js/jquery.cookie.js"></script>

		<script src='js/fullcalendar.min.js'></script>

		<script src='js/jquery.dataTables.min.js'></script>

		<script src="js/excanvas.js"></script>
	<script src="js/jquery.flot.js"></script>
	<script src="js/jquery.flot.pie.js"></script>
	<script src="js/jquery.flot.stack.js"></script>
	<script src="js/jquery.flot.resize.min.js"></script>

		<script src="js/jquery.chosen.min.js"></script>

		<script src="js/jquery.uniform.min.js"></script>

		<script src="js/jquery.cleditor.min.js"></script>

		<script src="js/jquery.noty.js"></script>

		<script src="js/jquery.elfinder.min.js"></script>

		<script src="js/jquery.raty.min.js"></script>

		<script src="js/jquery.iphone.toggle.js"></script>

		<script src="js/jquery.uploadify-3.1.min.js"></script>

		<script src="js/jquery.gritter.min.js"></script>

		<script src="js/jquery.imagesloaded.js"></script>

		<script src="js/jquery.masonry.min.js"></script>

		<script src="js/jquery.knob.modified.js"></script>

		<script src="js/jquery.sparkline.min.js"></script>

		<script src="js/counter.js"></script>

		<script src="js/retina.js"></script>

		<script src="js/custom.js"></script>
	<!-- end: JavaScript-->

</body>
</html>
